#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int maxDifference(string s) {
        int letter[26] = { 0 };
        for (auto& c : s)
        {
            letter[c - 'a']++;
        }
        int odd = 0, even = INT_MAX;
        for (auto& e : letter)
        {
            if (e % 2 != 0)
                odd = max(odd, e);
            else if (e != 0)
                even = min(even, e);
        }
        return odd - even;
    }
};